package com.wufan.day02;

/**
 * @author SongWufan
 * @date 2021/3/3 23:48
 */
public class PrimeTest {
    public static void main(String[] args) {
        boolean isFlag = true;
        int count = 0;

        //获取当前时间
        long start = System.currentTimeMillis();

        for (int i = 2; i <= 100; i++){
            for (int j = 2;j <= Math.sqrt(i); j++){
                if (i % j == 0){
                    isFlag = false;
                    break;
                }
            }
            if (isFlag){
                count++;
            }
            isFlag = true;
        }
        long end = System.currentTimeMillis();
        System.out.println("个数："+count);
        System.out.println("所花时间："+(end - start));
    }
}
